﻿package treatBehavior
{
	import flash.geom.Point;
	
	public class MoveAverageBehavior implements ITreatBehavior
	{
													//----------------------------------------------API------------------------------------
													//================ Properties ===============
													
													//================ Constants ================

													//================ Constructor ==============
		public function MoveAverageBehavior(aVal:Array,dVal:Number,nVal:uint):void
		{
			arr=aVal;
			d=dVal;
			n=nVal;
		}													
													//================ Public Methods ===========
		public function getTreatArr():Array
		{
			var resultArr:Array=new Array();
			var tempX:Number=0;
			var tempY:Number=0;
			for(var i:uint=0;i<arr.length-_moveStep+1;i++)
			{
				for(var j:uint=i;j<i+_moveStep;j++)
				{
					tempX+=arr[j].x;
					tempY+=arr[j].y;
				}
				var tempP:Point=new Point();
				tempP.x=tempX/_moveStep;
				tempP.y=tempY/_moveStep;
				resultArr.push(tempP);
				tempX=0;
				tempY=0;
			}
			//trace(resultArr.length);
			return resultArr;
		}
		public function set moveStep(s:int):void
		{
			_moveStep=s;
		}
		public function get moveStep():int
		{
			return _moveStep;
		}
													//----------------------------------------------private--------------------------------
													
													//================ Properties ===============
		private var arr:Array;
		private var d:Number;
		private var n:uint;
		private var _moveStep:int;
													//================ Private Methods ==========

													//================ Destroy ==================



		
	}
}